package kr.co.m2soft.delegate
{
	import events.HTTPCommanderEvent;
	
	import flash.events.IEventDispatcher;
	
	import kr.co.m2soft.model.CommonModel;
	import kr.co.m2soft.model.document.Head;
	import kr.co.m2soft.model.document.MML;
	import kr.co.m2soft.model.elements.Document;
	
	import rpc.HTTPCommanderDelegate;
	
	public class MMLParserDelegate extends HTTPCommanderDelegate
	{
		private var root:Object;
		private var head:Head = new Head();
		private var document:Document = new Document();
		private var commonModel:CommonModel = CommonModel.getInstance();
		public function MMLParserDelegate(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		override public function delegateHandler(event:HTTPCommanderEvent):void
		{
			//resultData = {a:11}
			//dataProvider.hasOwnProperty(
			root = dataProvider.MML;
			
			var mml:MML = new MML();
			mml.dataProvider = dataProvider;
			commonModel.mml = mml;
			mml.parser();
			resultData = mml;
			
			
			super.delegateHandler(event);
		}
	}
}